/**
 *
 */
package com.totyu.bpo.raffle.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.totyu.bpo.raffle.domain.User;

/**
 * @author yuqy
 *
 */
public interface UserRepository extends JpaRepository<User, Long> {

	@Query("select u from User u where u.empName = :empName or u.empCd = :empCd")
	List<User> findByEmpNameOrEmpCd(@Param("empName") String empName, @Param("empCd") String empCd);

	@Modifying
	@Query("update User u set u.ticketCard = ?1 where u.id = ?2")
	int updateTicketCard(String ticketCard, Long id);

	@Modifying
	@Query("update User u set u.winningNumbers = ?1 where u.id = ?2")
	int updateWinningNumbers(String winningNumbers, Long id);

}
